private static final ThreadLocal<Session> sessions = 
                                  new ThreadLocal<Session>();
private SessionFactory sessionFactory;
public Session getLocalSession(){
	Session session = sessions.get();
	if (session == null) {
		session = sessionFactory.openSession();
		sessions.set(session);
	}
	return session;
}